// @ts-nocheck
import { menuInt } from "@/api/home/type";

/**
 * 转换菜单
 * @param pid
 * @param list
 */
export function makeTree(data, parentId = -1) {
  const menu = data
    .filter((item) => item.pid === parentId)
    .map((item) => {
      const { id, cname, path } = item;
      const children = makeTree(data, id);
      return {
        id,
        title: cname,
        path,
        children: children.length ? children : null,
      };
    });
  return menu;
}
